package com.goktech.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.goktech.dao.OrderDao;
import com.goktech.dao.OrderItemDao;
import com.goktech.dao.StudentDao;
import com.goktech.domain.Order;
import com.goktech.domain.OrderItem;
import com.goktech.service.OrderService;

public class OrderServiceImpl implements OrderService {
	
	@Autowired
	private OrderDao orderDao;
	
	@Autowired
	private OrderItemDao itemDao;
		
	@Override
	public boolean add(Order order, List<OrderItem> orderItems) {
		boolean condition= orderDao.insert(order) > 0 ? true : false;
		for (OrderItem item : orderItems) {
			boolean flag=itemDao.insert(item) > 0 ? true : false;
			if (!flag) {
				return false;
			}
		}
		return condition;
	}

	@Override
	public boolean check(Integer status) {
		// TODO Auto-generated method stub
		return false;
	}

}
